package application;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.LoggerFactory;

public class MyLogger extends Logger {

	static String FQCN = MyLogger.class.getName() + ".";

	/**
	 * Just calls the parent constuctor.
	 */
	public MyLogger(String name) {
		super(name);
	}

	/**
	 * Overrides the standard debug method by appending " world" at the end of
	 * each message.
	 */
	public void debug(Object message) {
		super.log(FQCN, Level.DEBUG, message, null);
	}

	/**
	 * This method overrides {@link Logger#getLogger} by supplying its own
	 * factory type as a parameter.
	 */
	public static Logger getLogger(String name) {
		return Logger.getLogger(name, new LoggerFactory() {
			public Logger makeNewLoggerInstance(String name) {
				return new MyLogger(name);
			}
		});
	}

	public void trace(Object message) {
		super.log(FQCN, Level.TRACE, message, null);
	}
}